# -*- coding: utf-8 -*- 
#
# Description:
#
#  Definiton
#
#
#
# Changes:
#
# 2012-01-10
# Initial Commit
#
#
# Copyright 2010-2012, WyDev Team.
# Author: Polo35 (polo35580@hotmail.fr)
#
# Licenced under Academic Free License version 3.0
# Review WyGui README & LICENSE files for further details.

nname: 0
n 0(None)[ActionItem.__init__(self, name=language.title(), action=self.translate, type_='')
self.translator = translator
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb759842c>}
nname: 0
n 0(None)[self.translator.install()
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb759812c>}
nname: 6
n 6(None)[def __init__(self, language, translator):
	ActionItem.__init__(self, name=language.title(), action=self.translate, type_='')
	self.translator = translator

def translate(self):
	self.translator.install()

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb7596d4c>}
nname: 67
n 67(None)[del _[1]
return l10n.available_languages.iteritems()
]:
	i: 0(AF), 39()
	o: 

nname: 39
n 39(None)[]:
	i: 0(for)
	o: 67()

nname: 0
n 0(None)[from pygui.facilities import l10n
]:
	i: 
	o: 39(for), 67(AF)

nname: 67
n 67(None)[del _[1]
return l10n.available_languages.iteritems()
]:
	i: 0(AF), 0(for)
	o: 

nname: 0
n 0(None)[from pygui.facilities import l10n
]:
	i: 
	o: 67(AF)

self.nodes: {0: <unpyclib.structure.node instance at 0xb7596f0c>, 67: <unpyclib.structure.node instance at 0xb7596f8c>}
nname: 96
n 96(None)[]:
	i: 3(), 69(), 94(AE)
	o: 

nname: 94
n 94(None)[]:
	i: 59(f)
	o: 96(AE)

nname: 69
n 69(None)[#, e
log.warn('Unable to set the country for wyscan (%r)', e)
]:
	i: 59(t)
	o: 96()

nname: 59
n 59(<dummy_ex3> EXC_MATCH Exception)[]:
	i: 0(except)
	o: 69(t), 94(f)

nname: 3
n 3(None)[iso_3166_lang = country_dict[val]['iso-3166']
from pygui.item.parameters.tv import wyscanserver
wyscan = wyscanserver()
wyscan.SetIso3166CountryCode(iso_3166_lang)
]:
	i: 0(try)
	o: 96()

nname: 0
n 0(None)[]:
	i: 
	o: 3(try), 59(except)

nname: 59
n 59(None)[except Exception, e:
	log.warn('Unable to set the country for wyscan (%r)', e)
]:
	i: 0()
	o: 

nname: 0
n 0(None)[try:
	iso_3166_lang = country_dict[val]['iso-3166']
	from pygui.item.parameters.tv import wyscanserver
	wyscan = wyscanserver()
	wyscan.SetIso3166CountryCode(iso_3166_lang)
]:
	i: 
	o: 59()

nname: 0
n 0(None)[try:
	iso_3166_lang = country_dict[val]['iso-3166']
	from pygui.item.parameters.tv import wyscanserver
	wyscan = wyscanserver()
	wyscan.SetIso3166CountryCode(iso_3166_lang)
except Exception, e:
	log.warn('Unable to set the country for wyscan (%r)', e)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75989ec>}
nname: 6
n 6(None)[translation_dict = l10n.UnicodeDict(dict(<genexpr>(country_dict)))
depth = 2
def execute_action(self, val):
	try:
		iso_3166_lang = country_dict[val]['iso-3166']
		from pygui.item.parameters.tv import wyscanserver
		wyscan = wyscanserver()
		wyscan.SetIso3166CountryCode(iso_3166_lang)
	except Exception, e:
		log.warn('Unable to set the country for wyscan (%r)', e)

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb7596eec>}
nname: 0
n 0(None)[self.translation_dict = l10n.UnicodeDict(dict(<genexpr>(country_dict)))
UserConfigSetupItem.__init__(self, *args, **kw)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75983cc>}
nname: 6
n 6(None)[def __init__(self, *args, **args):
	self.translation_dict = l10n.UnicodeDict(dict(<genexpr>(country_dict)))
	UserConfigSetupItem.__init__(self, *args, **kw)

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb7596e2c>}
nname: 0
n 0(None)[UserConfigSetupItem.__init__(self, **kw)
self.exec_callback = exec_callback
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75986ec>}
nname: 158
n 158(None)[]:
	i: 65(), 131(), 156(AE)
	o: 

nname: 156
n 156(None)[]:
	i: 121(f)
	o: 158(AE)

nname: 131
n 131(None)[#, e
log.warn('Unable to set the language for wyscan (%r)', e)
]:
	i: 121(t)
	o: 158()

nname: 121
n 121(<dummy_ex3> EXC_MATCH Exception)[]:
	i: 62(except)
	o: 131(t), 156(f)

nname: 65
n 65(None)[iso_639_lang = country_dict[val]['iso-639-2']
from pygui.item.parameters.tv import wyscanserver
wyscan = wyscanserver()
wyscan.SetIso639LanguageCode(iso_639_lang)
]:
	i: 62(try)
	o: 158()

nname: 62
n 62(None)[]:
	i: 41(), 61()
	o: 65(try), 121(except)

nname: 61
n 61(None)[]:
	i: 0&22(f)
	o: 62()

nname: 41
n 41(None)[self.menu.related_menu.on_modify_lang()
]:
	i: 0&22(t)
	o: 62()

nname: 0&22
n 0&22(self.exec_callback and hasattr(self.menu, 'related_menu'))[l10n.set_language(val)
]:
	i: 
	o: 41(t), 61(f)

nname: 121
n 121(None)[except Exception, e:
	log.warn('Unable to set the language for wyscan (%r)', e)
]:
	i: 0&22()
	o: 

nname: 0&22
n 0&22(None)[l10n.set_language(val)
if self.exec_callback and hasattr(self.menu, 'related_menu'):
	self.menu.related_menu.on_modify_lang()
try:
	iso_639_lang = country_dict[val]['iso-639-2']
	from pygui.item.parameters.tv import wyscanserver
	wyscan = wyscanserver()
	wyscan.SetIso639LanguageCode(iso_639_lang)
]:
	i: 
	o: 121()

nname: 0&22
n 0&22(None)[l10n.set_language(val)
if self.exec_callback and hasattr(self.menu, 'related_menu'):
	self.menu.related_menu.on_modify_lang()
try:
	iso_639_lang = country_dict[val]['iso-639-2']
	from pygui.item.parameters.tv import wyscanserver
	wyscan = wyscanserver()
	wyscan.SetIso639LanguageCode(iso_639_lang)
except Exception, e:
	log.warn('Unable to set the language for wyscan (%r)', e)
]:
	i: 
	o: 

self.nodes: {'0&22': <unpyclib.structure.node instance at 0xb7598b2c>}
nname: 6
n 6(None)[depth = 2
translation_dict = dict(<genexpr>(country_dict))
def __init__(self, exec_callback=False, **kw):
	UserConfigSetupItem.__init__(self, **kw)
	self.exec_callback = exec_callback

def execute_action(self, val):
	l10n.set_language(val)
	if self.exec_callback and hasattr(self.menu, 'related_menu'):
		self.menu.related_menu.on_modify_lang()
	try:
		iso_639_lang = country_dict[val]['iso-639-2']
		from pygui.item.parameters.tv import wyscanserver
		wyscan = wyscanserver()
		wyscan.SetIso639LanguageCode(iso_639_lang)
	except Exception, e:
		log.warn('Unable to set the language for wyscan (%r)', e)

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb7596fec>}
nname: 0
n 0(None)[config.user_config['video']['language'] = val
OSDLanguageUserConfigSetupItem.execute_action(self, val)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb759810c>}
nname: 6
n 6(None)[def execute_action(self, val):
	config.user_config['video']['language'] = val
	OSDLanguageUserConfigSetupItem.execute_action(self, val)

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb7596e4c>}
nname: 0
n 0(None)[from __future__ import absolute_import
import pygui.config as config
from pygui.facilities.codemapping import country_dict
from pygui.facilities import l10n
from pygui.item.core import ActionItem
from pygui.item.parameters import UserConfigSetupItem
from peewee.debug import GET_LOGGER
log = GET_LOGGER(__name__)
class LanguageItem(ActionItem):
	def __init__(self, language, translator):
		ActionItem.__init__(self, name=language.title(), action=self.translate, type_='')
		self.translator = translator

	def translate(self):
		self.translator.install()



def getitem():
	from pygui.facilities import l10n

class CountryUserConfigSetupItem(UserConfigSetupItem):
	translation_dict = l10n.UnicodeDict(dict(<genexpr>(country_dict)))
	depth = 2
	def execute_action(self, val):
		try:
			iso_3166_lang = country_dict[val]['iso-3166']
			from pygui.item.parameters.tv import wyscanserver
			wyscan = wyscanserver()
			wyscan.SetIso3166CountryCode(iso_3166_lang)
		except Exception, e:
			log.warn('Unable to set the country for wyscan (%r)', e)



class LanguageUserConfigSetupItem(UserConfigSetupItem):
	def __init__(self, *args, **args):
		self.translation_dict = l10n.UnicodeDict(dict(<genexpr>(country_dict)))
		UserConfigSetupItem.__init__(self, *args, **kw)



class OSDLanguageUserConfigSetupItem(UserConfigSetupItem):
	depth = 2
	translation_dict = dict(<genexpr>(country_dict))
	def __init__(self, exec_callback=False, **kw):
		UserConfigSetupItem.__init__(self, **kw)
		self.exec_callback = exec_callback

	def execute_action(self, val):
		l10n.set_language(val)
		if self.exec_callback and hasattr(self.menu, 'related_menu'):
			self.menu.related_menu.on_modify_lang()
		try:
			iso_639_lang = country_dict[val]['iso-639-2']
			from pygui.item.parameters.tv import wyscanserver
			wyscan = wyscanserver()
			wyscan.SetIso639LanguageCode(iso_639_lang)
		except Exception, e:
			log.warn('Unable to set the language for wyscan (%r)', e)



class FirstBootLanguageUserConfigSetupItem(OSDLanguageUserConfigSetupItem):
	def execute_action(self, val):
		config.user_config['video']['language'] = val
		OSDLanguageUserConfigSetupItem.execute_action(self, val)



]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb758ab8c>}
from __future__ import absolute_import
import pygui.config as config
from pygui.facilities.codemapping import country_dict
from pygui.facilities import l10n
from pygui.item.core import ActionItem
from pygui.item.parameters import UserConfigSetupItem
from peewee.debug import GET_LOGGER
log = GET_LOGGER(__name__)
class LanguageItem(ActionItem):
	def __init__(self, language, translator):
		ActionItem.__init__(self, name=language.title(), action=self.translate, type_='')
		self.translator = translator

	def translate(self):
		self.translator.install()



def getitem():
	from pygui.facilities import l10n

class CountryUserConfigSetupItem(UserConfigSetupItem):
	translation_dict = l10n.UnicodeDict(dict(<genexpr>(country_dict)))
	depth = 2
	def execute_action(self, val):
		try:
			iso_3166_lang = country_dict[val]['iso-3166']
			from pygui.item.parameters.tv import wyscanserver
			wyscan = wyscanserver()
			wyscan.SetIso3166CountryCode(iso_3166_lang)
		except Exception, e:
			log.warn('Unable to set the country for wyscan (%r)', e)



class LanguageUserConfigSetupItem(UserConfigSetupItem):
	def __init__(self, *args, **args):
		self.translation_dict = l10n.UnicodeDict(dict(<genexpr>(country_dict)))
		UserConfigSetupItem.__init__(self, *args, **kw)



class OSDLanguageUserConfigSetupItem(UserConfigSetupItem):
	depth = 2
	translation_dict = dict(<genexpr>(country_dict))
	def __init__(self, exec_callback=False, **kw):
		UserConfigSetupItem.__init__(self, **kw)
		self.exec_callback = exec_callback

	def execute_action(self, val):
		l10n.set_language(val)
		if self.exec_callback and hasattr(self.menu, 'related_menu'):
			self.menu.related_menu.on_modify_lang()
		try:
			iso_639_lang = country_dict[val]['iso-639-2']
			from pygui.item.parameters.tv import wyscanserver
			wyscan = wyscanserver()
			wyscan.SetIso639LanguageCode(iso_639_lang)
		except Exception, e:
			log.warn('Unable to set the language for wyscan (%r)', e)



class FirstBootLanguageUserConfigSetupItem(OSDLanguageUserConfigSetupItem):
	def execute_action(self, val):
		config.user_config['video']['language'] = val
		OSDLanguageUserConfigSetupItem.execute_action(self, val)



